package com.gdt.bdMessageQueue.service;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;

import com.gdt.bdMessageQueue.pojo.ActiveMqMonitor;

public class MessageService {
	
	@Autowired
	ActiveMqMonitorService acMService;

	private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
	 public String handleProtocolMessage(String messageText) {
		 
		/* System.out.println("接受到的queueName: "+ queueName);
		 //首先判断queueName是否在服务期内
		 ActiveMqMonitor aqM = acMService.getActiveMqMonitorByQueueName(queueName);
		 Date startTime = aqM.getStartServiceTime();
		 Date stopTime = aqM.getStopServiceTime();
		 String responseText =null;
		 try {
			Date time = dateFormat.parse(dateFormat.format(new Date()));
			if(acMService.isTimeIn(time, startTime, stopTime)){
				
				//  System.out.println("responseText is : "+ messageText);
				if ("x".equalsIgnoreCase(messageText)) {
					responseText = "x坐标";
				}
				if ("y".equalsIgnoreCase(messageText)) {
					responseText = "y坐标";
				}
				if ("z".equalsIgnoreCase(messageText)){
					responseText = "z坐标";
				}
			}else{
				responseText ="服务已过期，请重新申请";
			}
			
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}*/
		 
	         
	        return messageText;
	    }
}
